<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<form class="form-horizontal" role="form" id="form">
    <div class="form-group">
        <label for="sex" class="col-sm-2 control-label">aa</label>
        <div class="col-sm-10">
            <div id="sex" class="cc-ComboDict" remark="必须选择一样" initValue="1"  model="1" data-options="'dictCode':'sex',multiple:true" style="width: 200px"></div>
        </div>
    </div>

    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <input type="button" value="setValue" onclick="setValue()">
            <input type="button" value="getAddData" onclick="getAddData()">
            <input type="button" value="getEditData" onclick="getEditData()">
            <input type="button" value="reset" onclick="reset1()">
            <input type="button" value="clear" onclick="clear1()">
            <input type="button" value="isValid" onclick="isValid()">
            <input type="button" value="destroy" onclick="destroy()">
            <input type="button" value="editModel" onclick="editModel()">
            <input type="button" value="showModel" onclick="showModel()">
        </div>
    </div>
</form>

<script type="text/javascript" src="../lib/jquery/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="../lib/layer/layer.js"></script>

<script type="text/javascript" src="../lib/handlebars/handlebars-v4.0.5.js"></script>
<script type="text/javascript" src="../lib/handlebars/handlebars-extend.js"></script>

<link href="../lib/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<script type="text/javascript" src="../lib/bootstrap/js/bootstrap.min.js"></script>

<script type="text/javascript"  src="../lib/common/common.js"></script>

<link type="text/css" href="../lib/component/css/cc.css" rel="stylesheet" />
<script type="text/javascript"  src="../lib/component/js/cc.js"></script>

<script type="text/javascript">


    $(function(){
      _$.parser.parse()
    });
    function editModel(){
        var name = _$.getById("sex");
        name.setModel(1);
    }
    function showModel(){
        var name = _$.getById("sex");
        name.setModel(0);
    }
    function setValue(){
        var form = new _$.Form("#form");
        var values = {"name":"aa","realName":"bb","age":20};

        form.setValue(values)
    }
    function getAddData(){

        var form = new _$.Form("#form");
        var values = form.getAddData();
        alert(JSON.stringify(values))
    }
    function getEditData(){

        var form = new _$.Form("#form");
        var values = form.getEditData();
        alert(JSON.stringify(values))
    }
    function reset1(){

        var form = new _$.Form("#form");
        form.reset();
    }
    function clear1(){

        var form = new _$.Form("#form");
        form.clear();
    }
    function isValid(){

        var form = new _$.Form("#form");
        var flag = form.isValid();
        console.log("==================" + flag)
    }

    function destroy(){
        var name = _$.getById("name");
        name.destroy();
        var realName = _$.getById("realName");
        realName.destroy();
        var memo = _$.getById("memo");
        memo.destroy();
        var age = _$.getById("age");
        age.destroy();
    }

</script>
</body>
</html>
